package com.aistar.order.mapper;

import com.aistar.order.entity.EntranceTicketOrder;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * Created by Administrator on 2019/6/25 0025.
 */
public interface EntranceTicketOrderMapper {
    //    找到具体订单
    @Select("select * from entrance_ticket_order where id = #{id}")
    EntranceTicketOrder findById(String id);
    //    找到一个用户所有的订单
    @Select("select * from entrance_ticket_order where user_id = #{userId}")
    List<EntranceTicketOrder> findMyOrder(String id);
    //    找到所有订单信息或根据id模糊查找
    @Select("select * from entrance_ticket_order where id like concat('%',#{id},'%')")
    List<EntranceTicketOrder> findAll(String id);
    //    保存订单的具体信息
    @Insert("insert into entrance_ticket_order values(" +
            "#{id},#{orderId},#{entranceTicketId},#{createDate},#{infoId},#{orderPrice}," +
            "#{billId},#{useDate},#{entraceTicketNumber},#{orderState},#{userId},#{appraise}" +
            ")")
    void save(EntranceTicketOrder entranceTicketOrder);
    //    根据id删除具体订单
    @Delete("delete from entrance_ticket_order where id = #{id}")
    void delete(String id);
    //   修改订单信息
    @Update("update entrance_ticket_order set " +
            "id=#{id},order_id=#{orderId},entrance_ticket_id=#{entranceTicketId},create_date=#{createDate}," +
            "info_id=#{infoId},order_price=#{orderPrice},bill_id=#{billId},use_date=#{useDate}," +
            "entrace_ticket_number=#{entraceTicketNumber},order_state=#{orderState},user_id=#{userId},appraise=#{appraise} where id=#{id}")
   void update(EntranceTicketOrder entranceTicketOrder);

}
